/*******************************************************************************
 * Copyright 2011 WaTho
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/
package de.wathoserver.android.dragoid.activity.singlebuilding;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;
import de.wathoserver.android.dragoid.R;
import de.wathoserver.android.dragoid.api.Building;
import de.wathoserver.android.dragoid.api.DragoStore;

/**
 * Übersichtstab von einem Gebäude. Zeigt Ausbaustufe, Zustand, erforschte
 * Gebäude und Renovierungskosten.
 * 
 * @author watho
 * 
 */
public class SingleBuildingInfoActivity extends Activity {

	private Building building;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.singlebuilding_info);
	}

	@Override
	protected void onResume() {
		super.onResume();
		Intent parentIntent = getIntent();
		int pos = parentIntent.getIntExtra(Building.COL_POSITION, -1);
		building = DragoStore.getDragoStore().getBuildings().get(pos);
		TextView textView = (TextView) findViewById(R.id.building_name);
		textView.setText(building.getName());
		((TextView) findViewById(R.id.building_desc)).setText(building
				.getDescription());
		((TextView) findViewById(R.id.building_condition)).setText(building
				.getCondition());
		((TextView) findViewById(R.id.building_renovation_costs))
				.setText(building.getRenovateCosts());
		((TextView) findViewById(R.id.building_develops)).setText(building
				.getDevelops());
		ImageView image = (ImageView) findViewById(R.id.singlebuildings_image);
		image.setImageDrawable(building.getImgForBuilding(getResources()));
	}
}
